# 1.在users表中查询注册时间最早的十条会员信息
select * from users order by cdate asc limit 10;


# 2.从两个表中查询点赞数最高的5条博客信息，要求显示字段：（博文id，标题，点赞数，会员名）
select blog.id AS "博文id",blog.title AS "标题",blog.pcount AS "点赞数",users.name AS "会员名" from blog right join users on users.id=blog.id order by blog.pcount desc limit 5;


# 3.统计每个会员的发表博文数量（降序），要求显示字段（会员id号，姓名，博文数量）
SELECT users.id AS `会员id号`,users.`name` AS `姓名`,Count(blog.id) AS `博文数量` FROM blog RIGHT JOIN users ON users.id = blog.id GROUP BY users.id ORDER BY `博文数量` DESC;


# 4.获取会员的博文平均点赞数量最高的三位。显示字段（会员id，姓名，平均点赞数）
select users.id as "会员id",users.name as "姓名",round(Avg(blog.pcount),0) as "平均点赞数" from blog right join users on users.id=blog.id  group by users.id order by "平均点赞数" desc limit 3;
# 5.删除没有发表博文的所有会员信息
delete from users where users.id not in(select id from blog group by id);




